package cn.liyiming.bbs.core.util;

import java.math.BigDecimal;
import java.math.BigInteger;

/**
 * @program: bbsblog
 * @description: 获取对应值
 * @author: 李一鸣
 * @create: 2020-03-22 00:14
 **/

public class Decimalutil {
    public static Long getLong(Object object) {
        if (object == null) {
            return null;
        }
        if (object instanceof BigDecimal) {
            return ((BigDecimal) object).longValue();
        }
        if (object instanceof BigInteger) {
            return ((BigInteger) object).longValue();
        }
        if (object instanceof Long) {
            return ((Long) object);
        }
        return null;
    }
}
